package com.truthbean.jutils.demo.javax;

import javax.validation.constraints.*;
import java.math.BigDecimal;
import java.util.Date;

/**
 * Created by TruthBean on 2016-09-02 15:06.
 */
public class User {
    @AssertFalse
    private boolean isUnsupported;

    @AssertTrue
    private boolean isActive;

    @DecimalMax("30.00")
    @DecimalMin("5.00")
    private BigDecimal discount;

    @Digits(integer=6, fraction=2)
    private BigDecimal price;

    @Future
    private Date eventDate;

    @Past
    private Date birthday;

    @Min(0)
    @Max(value = 9, message = "ID最大为9")
    private int id;

    @NotNull(message = "用户名不能为空")
    private String name;

    @NotNull(message = "邮件地址不能为空")
    private String email;

    @Pattern(regexp="\\(\\d{3}\\)\\d{3}-\\d{4}")
    private String phoneNumber;

    @Size(min=2, max=240)
    private String briefMessage;

    public boolean isUnsupported() {
        return isUnsupported;
    }

    public void setUnsupported(boolean unsupported) {
        isUnsupported = unsupported;
    }

    public boolean isActive() {
        return isActive;
    }

    public void setActive(boolean active) {
        isActive = active;
    }

    public BigDecimal getDiscount() {
        return discount;
    }

    public void setDiscount(BigDecimal discount) {
        this.discount = discount;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public Date getEventDate() {
        return eventDate;
    }

    public void setEventDate(Date eventDate) {
        this.eventDate = eventDate;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    public String getBriefMessage() {
        return briefMessage;
    }

    public void setBriefMessage(String briefMessage) {
        this.briefMessage = briefMessage;
    }

    public User(){}
}
